﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using GestionePolveriLib.BL.Metadata;
using System.ComponentModel;

namespace GestionePolveriLib.BL
{
    [Serializable]
    [MetadataType(typeof(ScortaMinimaMetadata))]
    public class ScortaMinimaInfo : Polvere
    {
        private DateTime? m_dataRiordino = null;
        private DateTime? m_dataChiusuraRiordino = null;

        [DisplayName("Data Riordino")]
        public DateTime? DataRiordino
        {
            get { return m_dataRiordino; }
            set 
            {
                if (value == DateTime.MinValue)
                    m_dataRiordino = null;
                else
                    m_dataRiordino = value; 
            }
        }

        [Browsable(false)]
        public DateTime? DataChiusuraRiordino
        {
            get { return m_dataChiusuraRiordino; }
            set
            {
                if (value == DateTime.MinValue)
                    m_dataChiusuraRiordino = null;
                else
                    m_dataChiusuraRiordino = value;
            }
        }

        public bool IsGeneratedByCorrection { get; set; }

        public double Prezzo { get; set; }
        public double Valore { get { return Giacenza.Value * Prezzo; } }
        public double Carico { get; set; }
        public double Scarico { get; set; }
        public DateTime? DataControllo { get; set; }
        public string CodLotto { get; set; }
        public string NoteCarico { get; set; }
        public double CaricoScaricoDiff { get; set; }

        public ScortaMinimaInfo()
        {

        }
    }
}
